Every mesh has one or more renderers associated, which are
responsible to render the mesh, or in other words, send the mesh
data (vertex positions, texture coordinates, normals etc...) to
opengl. These renderers are child objects of the mesh (since both
the mesh and the renderer objects are inherited from TreeNode) They are used
in different circumstances, for example mudbox uses one renderer
for plain rendering, and another one for wireframe rendering. These
renderer object can hold cached buffers in memory, to be able to
render the mesh as fast as possible. The reason why mudbox keeps
multiple renderers and not uses a single one to render the mesh in
different modes is that this way the renderers can hold
precalculated data in buffers. A naiv implementation of this
interface would go through all the faces in the mesh, and pump the
mesh data with immediate opengl calls to the hardware, but of
course this solution would be slow for most of the objects.
|
Public Member Functions
|
virtual const mudbox::ClassDesc
* |
RuntimeClass (void)
const |
virtual void |
Initialize (void) |
|
This function is called when the plugin
first used. This is responsible for one time initialization.
|
virtual void |
SetMesh (Mesh *pMesh) |
|
Called to set the mesh for the renderer
node. Usually called only once right after the creation of a node.
Each mesh has its own renderer nodes so dont expect this function
to be called often.
|
virtual void |
Render (const Selector
*pSelector=0, bool bSkipMaterials=false, const Camera *pCamera=0, const
AxisAlignedBoundingBox
&bUVFilter=AxisAlignedBoundingBox()) |
|
Render the mesh to the current framebuffer
with the current pipeline settings.
|
virtual unsigned int |
RenderData (const
Selector
*pSelector, unsigned int iStart, const Camera *pCamera) |
|
This function is responsible to render some
data into the framebuffer, which later should tell the exact vertex
index of one of the corners of the current face. The rendered value
have to be greater or equal to iStart. The function have to return
the lowest value not used by the funtion (That value will be used
as iStart for further RenderData() calls).
See also VertexIndexFromData().
|
virtual void |
DecodeData (unsigned
int iData, unsigned int &iFaceIndex, unsigned int
&iVertexIndex) |
|
This function have to calculate the vertex
or face index from the value rendered by RenderData(). If a
value is unknown it must be set to 0xffffffff.
|
virtual void |
OnVertexPositionChange
(unsigned int iVertexIndex, unsigned int iFaceIndex) |
|
Called when any vertex of the associated
mesh is changed its position.
|
virtual void |
OnVertexStateChange
(unsigned int iVertexIndex, unsigned int iFaceIndex) |
|
Called when any vertex of the associated
mesh is changed its state.
|
virtual void |
OnMeshChange
(void) |
|
Called when the mesh changed in any way,
like changed the number of vertices or faces.
|
virtual void |
SetLODLevel (float
fLevel) |
|
Set the level of detail for the renderer.
|
virtual float |
LODLevel (void)
const |
|
Returns the level of detail for the
renderer.
|
virtual const AxisAlignedBoundingBox
& |
ActiveUVArea (void)
const |
|
Returns the currently rendered UV tile.
|
virtual void |
SetWireFrameMode (bool
bMode) |
|
Set wireframe status. If set to true, the
surface will be rendered as wireframe.
|
virtual bool |
WireFrameMode (void)
const |
|
Returns true if wireframe is on.
|
virtual void |
SetColorMode (bool
bMode) |
|
Set the color mode. If set to true, colors
for each vertex will be passed to the pipeline based on the status
of the vertex.
|
virtual bool |
ColorMode (void)
const |
|
Returns true if the renderer currently
contains color information.
|
virtual void |
SetWireLevel (unsigned
int iLevel) |
|
Set the subdivision level for the wireframe
display. Zero means the base level.
|
virtual unsigned int |
WireLevel (void)
const |
|
Returns the current wire level.
|
virtual void |
SetTextureCoordinateMode
(bool bMode) |
|
Set the texture coordinate mode. If true,
the texture coordinates will be passed to the opengl pipeline.
|
virtual bool |
TextureCoordinateMode
(void) const |
|
Returns true if the renderer contains
texture coordinates.
|
virtual void |
SetTangentMode (bool
bMode) |
|
Set the tangent mode. If true, tangents and
binormals will be also passed to the pipeline.
|
virtual bool |
TangentMode (void)
const |
|
Returns true if the renderer contains
tangents.
|
virtual bool |
ReadyForClientRender
() |
virtual void |
SetFacetedMode (bool
bMode) |
|
Set the faceted mode. If true, shading will
use face normal, otherwise it will use vertex normal.
|
virtual bool |
FacetedMode (void)
const |
|
Returns if faceted mode is on.
|
Static Public Member Functions
|
const mudbox::ClassDesc
* |
StaticClass (void) |
mudbox::Node
* |
CreateInstances
(unsigned int iCount=1) |
mudbox::MeshRenderer
mudbox::MeshRenderer mudbox::MeshRenderer mudbox::MeshRenderer
mudbox::MeshRenderer mudbox::MeshRenderer mudbox::MeshRenderer
mudbox::MeshRenderer mudbox::MeshRenderer
mudbox::MeshRenderer
mudbox::MeshRenderer
mudbox::MeshRenderer mudbox::MeshRenderer mudbox::MeshRenderer
mudbox::MeshRenderer mudbox::MeshRenderer mudbox::MeshRenderer
mudbox::MeshRenderer mudbox::MeshRenderer
mudbox::MeshRenderer